﻿@{
    ViewBag.Title = "ProjectBugList";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@using Common.BaseLibrary.Authorization
@using DepartmentWork.Model
@model List<DepartmentWork.Model.ProjectBugViewModel>

<link href="~/Assets/plugins/bootstrap-select/bootstrap-select.min.css" rel="stylesheet" />
<script src="~/Assets/plugins/bootstrap-select/bootstrap-select.min.js"></script>
<link href="~/Assets/plugins/bootstrap-datepicker/css/datepicker3.css" rel="stylesheet" />
<link href="~/Assets/plugins/bootstrap-datepicker/css/datepicker-theme.css" rel="stylesheet" />
<script src="~/Assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script src="~/Assets/plugins/chosen/chosen.jquery.min.js"></script>
<script src="~/Assets/js/pages/form-elements.js"></script>
<style>
    .btn-default {
        color: #333;
        background-color: #FFF;
        border-color: #CCC;
        height: 34px;
    }
</style>

<script>

    window.onload = function ()
    {
        $("#datetimepicker").datepicker({
            autoclose: true,
            pickerPosition: "bottom-right"
        });
        $("#edit_datetimepicker").datepicker({
            autoclose: true,
            pickerPosition: "bottom-right"
        });
    };

    function DelBug(bugId)
    {
        if (!confirm("请确认是否删除该BUG？"))
        {
            return false;
        }
        window.location.href = '@Url.Action("DeleteBug", "Bug", new { area = "DevelopArea" })' + '?bugId=' + bugId;
        }

</script>

<div class="page-header">
    <div class="pull-left">
        <ol class="breadcrumb visible-sm visible-md visible-lg">
            <li><a href="@Url.Action("Index","Home",new{area=""})"><i class="icon fa fa-home"></i>主页</a></li>
            <li><a href="@Url.Action("Index","Project",new{area="DevelopArea"})"><i class="fa fa-envelope"></i>开发模块</a></li>
            <li><a href="@Url.Action("ProjectInfo","Project",new{area="DevelopArea",projectId=ViewBag.ProjectId})"><i class="fa fa-envelope"></i>项目详情</a></li>
            <li class="active"><a href="#"><i class="fa fa-envelope"></i>BUG</a></li>
        </ol>
    </div>
</div>

@{
    if (ViewBag.Flag == "CreateTrue")
    {
    <div class="alert alert-success">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;BUG添加成功！</strong>
    </div>
    }
    if (ViewBag.Flag == "CreateFalse")
    {
    <div class="alert alert-danger">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;BUG添加失败！</strong> @ViewBag.Info
    </div>
    }

    if (ViewBag.Flag == "EditTrue")
    {
    <div class="alert alert-success">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;BUG编辑成功！</strong>
    </div>
    }
    if (ViewBag.Flag == "EditFalse")
    {
    <div class="alert alert-danger">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;BUG辑失败！</strong> @ViewBag.Info
    </div>
    }

    if (ViewBag.Flag == "DelTrue")
    {
    <div class="alert alert-success">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;BUG删除成功！</strong>
    </div>
    }
    if (ViewBag.Flag == "DelFalse")
    {
    <div class="alert alert-danger">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;BUG删除失败！</strong> @ViewBag.Info
    </div>
    }




    if (ViewBag.Flag == "SubmitTrue")
    {
    <div class="alert alert-success">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;BUG提交成功！</strong>
    </div>
    }
    if (ViewBag.Flag == "SubmitFalse")
    {
    <div class="alert alert-danger">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;BUG提交失败！</strong> @ViewBag.Info
    </div>
    }

    if (ViewBag.Flag == "PassTrue")
    {
    <div class="alert alert-success">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;BUG审核成功！</strong>
    </div>
    }
    if (ViewBag.Flag == "PassFalse")
    {
    <div class="alert alert-danger">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;BUG审核失败！</strong> @ViewBag.Info
    </div>
    }

    if (ViewBag.Flag == "ReturnTrue")
    {
    <div class="alert alert-success">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;BUG退回成功！</strong>
    </div>
    }
    if (ViewBag.Flag == "ReturnFalse")
    {
    <div class="alert alert-danger">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;BUG退回失败！</strong> @ViewBag.Info
    </div>
    }

}


<div class="row">
    <div class="col-lg-12">
        <div class="panel">
            <div class="panel-heading bk-bg-primary">
                <h6><i class="fa fa-table red"></i><span style="font-size: medium" class="break">@ViewBag.ProjectName 项目的 BUG列表</span></h6>
                @{
                    if (ViewBag.IsDevelopLeader == true)
                    {
                    <div class="panel-actions">
                        <a onclick="RestCreate()" data-toggle="modal" data-target="#TaskBookCreateModal" class="bk-margin-5 btn btn-default  btn-sm" style="background-color: #ECEDF0">&nbsp;&nbsp;新增BUG&nbsp;&nbsp;</a>
                    </div>
                    }
                }
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th>BUG名称</th>
                                <th>创建人</th>
                                <th>创建时间</th>
                                <th>处理人</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            @{
                                for (int i = 0; i < this.Model.Count(); i++)
                                {
                                    var item = this.Model[i];
                                <tr>
                                    <td>
                                        <a style="color:cornflowerblue" data-target="#BugInfoModal" onclick="ShowBugInfoModal('@item.BugId')" data-toggle="modal" >
                                            @item.BugName
                                        </a>
                                    </td>
                                    <td>@item.Creater</td>
                                    <td>@item.BugCreateTime</td>
                                    <td>@item.HandToUser</td>
                                    <td>
                                        @{
                                    if (item.BugCheckState == 0)
                                    {
                                            <span style="font-size: small" class="label label-warning">未提交</span>
                                    }
                                    else if (item.BugCheckState == 2)
                                    {
                                            if (item.Status!=3)
                                        {
                                                 <span style="font-size: small" class="label label-success">按时完成</span>
                                        }
                                            else
                                            {
                                                 <span style="font-size: small" class="label label-default">超时完成</span>
                                            }
                                    }
                                    else
                                    {
                                        switch (item.Status)
                                        {
                                            case 0:
                                                <span style="font-size: small" class="label label-warning">进行中</span>
                                                break;
                                            case 3:
                                                <span style="font-size: small" class="label label-danger">进行中（已超时）</span>
                                                break;
                                        }
                                    }
                                        }
                                    </td>
                                    <td>
                                        @{
@* 判断如果是项目管理员 或 是该任务的创建者 则 可以编辑 删除 提交 *@
                                    if (ViewBag.IsDevelopLeader == true || item.CreaterId == CurrentUser.UserID || item.HandToUser == CurrentUser.UserName)
                                    {
                                        if (item.BugCheckState == 0 && (ViewBag.IsDevelopLeader == true || item.CreaterId == CurrentUser.UserID))
                                        {
                                            <a style="color:cornflowerblue"  onclick="ShowBugEditModal('@item.BugId')" data-toggle="modal" data-target="#BugEditModal">编辑</a>
                                            @:&nbsp; &nbsp; &nbsp;
                                                    }
                                        if (ViewBag.IsDevelopLeader == true || item.CreaterId == CurrentUser.UserID)
                                        {
                                                       <a style="color:cornflowerblue" class="a_DeleteBug" onclick="DelBug('@item.BugId')">删除</a>
                                                        @:&nbsp; &nbsp; &nbsp;
                                                    }

                                        if (item.BugCheckState == 0)
                                        {
                                                        <a style="color:cornflowerblue" href="@Url.Action("SubmitTask", "Bug", new { area = "DevelopArea", BugId = item.BugId })">提交</a>
                                        }
                                        if (ViewBag.IsDevelopLeader == true && item.BugCheckState == 1)
                                        {
                                          
                                                        <a style="color:cornflowerblue" href="@Url.Action("PassTask", "Bug", new { area = "DevelopArea", BugId = item.BugId })">审核</a>
                                              @:&nbsp; &nbsp; &nbsp;
                                           
                                                        <a style="color:cornflowerblue" href="@Url.Action("ReturnTask", "Bug", new { area = "DevelopArea", BugId = item.BugId })">退回</a>
                                             @:&nbsp; &nbsp; &nbsp;
                                                    }
                                        else if (item.BugCheckState == 2)
                                        {

                                            if (ViewBag.IsDevelopLeader == true)
                                            {
                                                                  <a style="color:cornflowerblue" class="a_DeleteTask" onclick="DelTask('@item.BugId')" >删除</a>
                                                                 @:&nbsp; &nbsp; &nbsp; 
                                                        }

                                        }
                                                    
                                                    
                                    }
                                        }



                                    </td>
                                </tr> 
                                }
                            }
                        </tbody>
                    </table>
                    <div class="bk-margin-5 btn-group" style="float: right">
                        @Html.ShowPageNavigate((int)ViewData["pageIndex"], (int)ViewData["pageSize"], (int)ViewData["total"], (string)ViewBag.ProjectId)
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


@{
    List<UserInfoViewModel> userList = (List<UserInfoViewModel>)TempData["UserList"];
}


<!-- BUG详情 模态框（Modal） -->

<script>
    function ShowBugInfoModal(bugId)
    {
        //alert(data["Status"]);
        $.ajax({
            type: "POST",
            //url: "/KSManager/DevelopArea/Bug/GetBugInfo",
            url:'@Url.Action("GetBugInfo","Bug",new{area="DevelopArea"})',
            data: "bugId=" + bugId,
            error: function () { alert("服务器出错！"); },
            success: function (data)
            {
                // $("#TaskBookInfoModal").attr("aria-hidden", "true");
                $("#lb_BugName").text(data["BugName"]);
                $("#lb_BugCreater").text(data["Creater"]);
                $("#lb_BugHandToUser").text(data["HandToUser"]);
                
                var content = "";
                for (var i = 0; i < data["BugContext"].length; i++)
                {
                    if (i % 35 == 0 && i != 0)
                    {
                        content += data["BugContext"][i] + "<br/>";
                    } else
                    {
                        content += data["BugContext"][i];
                    }

                }
                $("#lb_BugContext").html(content);



                $("#lb_BugDeadTime").text(data["BugDeadTime"]);
                //$("#lb_BugHour").text(data["Hour"]);
                if (data["Status"] == 0)
                {
                    $("#lb_BugStatus").text('任务进行中');
                }
                else if (data["Status"] == 1)
                {
                    $("#lb_BugStatus").text('任务进行中但任务超时');
                }
                else if (data["Status"] == 2)
                {
                    $("#lb_BugStatus").text('任务完成');
                }
                else if (data["Status"] == 3)
                {
                    $("#lb_BugStatus").text('任务超时完成');
                }

                if (data["Level"] == 0)
                {
                    $("#lb_BugLevel").text('低');
                }
                else if (data["Level"] == 1)
                {
                    $("#lb_BugLevel").text('中');
                }
                else if (data["Level"] == 2)
                {
                    $("#lb_BugLevel").text('高');
                }

                if (data["BugFileSaveName"] == "")
                {
                    //$("#lb_BugFile").text("");
                    $("#a_DownloadBugFile").text("");
                } else
                {
                    //$("#lb_BugFile").text(data["BugFileShowName"]);
                    $("#a_DownloadBugFile").text(data["BugFileShowName"]);
                    //$("#a_DownloadBugFile").attr("href", "http:////" + data["BugFilePath"] + '//' + data["BugFileSaveName"]);
                    $("#a_DownloadBugFile").attr("href", '@Url.Content("~/Home/DownLoadFile?filePath=")' + data["BugFileSaveName"] + "&type=Bug&fileName=" + data["BugFileSaveName"]);
                }

            }
        });
    }

</script>

<div class="modal fade" id="BugInfoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">BUG详情
                </h4>
            </div>
            <div class="modal-body" style="font-size: small">
                <div class="row">
                    <label class="col-md-3 control-label" for="text-input">BUG名称：</label>
                    <div class="col-md-9">
                        <label id="lb_BugName" style="width: 100%" class="col-md-3 control-label" for="text-input"></label>
                    </div>
                </div>
                <hr />

                <div class="row">
                    <label class="col-md-3 control-label" for="text-input">创建人：</label>
                    <div class="col-md-9">
                        <label id="lb_BugCreater" style="width: 100%" class="col-md-8 control-label" for="text-input"></label>
                    </div>
                </div>
                <hr />

                <div class="row">
                    <label class="col-md-3 control-label" for="text-input">BUG处理人：</label>
                    <div class="col-md-9">
                        <label id="lb_BugHandToUser" style="width: 100%" class="col-md-8 control-label" for="text-input"></label>
                    </div>
                </div>

                <hr />

                <div class="row">
                    <label class="col-md-3 control-label" for="text-input">BUG详情：</label>
                    <div class="col-md-9">
                        <label id="lb_BugContext" style="width: 100%" class="col-md-8 control-label" for="text-input"></label>
                    </div>
                </div>

                <hr />

                <div class="row">
                    <label class="col-md-3 control-label" for="text-input">BUG级别：</label>
                    <div class="col-md-9">
                        <label id="lb_BugLevel" style="width: 100%" class="col-md-8 control-label" for="text-input"></label>
                    </div>
                </div>

                <hr />

                <div class="row">
                    <label class="col-md-3 control-label" for="text-input">BUG截止日期：</label>
                    <div class="col-md-9">
                        <label id="lb_BugDeadTime" style="width: 100%" class="col-md-3 control-label" for="text-input"></label>
                    </div>
                </div>
                <hr />

                <div class="row">
                    <label class="col-md-3 control-label" for="text-input">BUG状态：</label>
                    <div class="col-md-9">
                        <label id="lb_BugStatus" style="width: 100%" class="col-md-8 control-label" for="text-input"></label>
                    </div>
                </div>

                <hr />

                <div class="row">
                    <label class="col-md-3 control-label" for="text-input">BUG附件：</label>
                    <div class="col-md-9">
                        <a id="a_DownloadBugFile">
                            <label id="lb_BugFile" style="width: 100%" class="col-md-8 control-label" for="text-input"></label>
                        </a>
                    </div>
                </div>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">
                    关闭
                </button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal -->
</div>

<!-- 编辑BUG 模态框（Modal） -->


<script>
    function ShowBugEditModal(bugId)
    {
        $("#hid_EditBugId").val(bugId);
        $.ajax({
            type: "POST",
            //url: "/KSManager/DevelopArea/Bug/GetBugInfo",
            url:'@Url.Action("GetBugInfo","Bug",new{area="DevelopArea"})',
            data: "bugId=" + bugId,
            error: function () { alert("服务器出错！"); },
            success: function (data)
            {
                // $("#TaskBookInfoModal").attr("aria-hidden", "true");
                //$("#hid_EditTaskId").val(taskId);
                $("#tb_EditBugName").val(data["BugName"]);
                //$("#tb_EditCreater").val(data["Creater"]);
                $("#tb_EditBugContext").text(data["BugContext"]);
                //$("#select_EditTaskLevel").val(data["TaskCreateTime"]);
                //$("#select_EditBugHandToUser").val(data["Hour"]);
                $("#tb_EditBugDeadTime").val(data["BugDeadTime"]);//截止日期
                //$("#edit_datetimepicker").val(data["TaskCreateTime"]);
                $("#edit_datetimepicker").attr('data-date', data["BugDeadTime"]);

                $("#select_EditBugHandToUser option").each(function ()
                {
                    if ($(this).text() == data["HandToUser"])
                    {
                        $(this).attr("selected", "selected");
                    }
                });
                $("#select_EditBugLevel option").each(function ()
                {
                    if ($(this).val() == data["Level"])
                    {
                        $(this).attr("selected", "selected");
                    }
                });

                if (data["BugFileSaveName"] == "")
                {
                    $("#lb_EditBugFile").text("");
                } else
                {
                    $("#lb_EditBugFile").text(data["BugFileShowName"]);
                    //$("#a_DownloadOldTaskFile").attr("href", "http:////" + data["BugFilePath"] + '//' + data["BugFileSaveName"]);
                    $("#a_EditDownloadBugFile").attr("href", '@Url.Content("~/Home/DownLoadFile?filePath=")' + data["BugFileSaveName"] + "&type=Bug&fileName=" + data["BugFileSaveName"]);

                }

            }
        });
    }

</script>

<div class="modal fade" id="BugEditModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">编辑BUG
                </h4>
            </div>
            <form action="@Url.Action("EditBug", "Bug")" method="POST" enctype="multipart/form-data">
                <input type="hidden" id="hid_EditBugId" name="hid_EditBugId" />
                <div class="modal-body">
                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">BUG名称：</label>
                        <div class="col-md-9">
                            <input id="tb_EditBugName" name="tb_EditBugName" style="border-color: cornflowerblue" name="text-input" class="form-control" placeholder="Text" type="text">
                        </div>
                    </div>
                    <br />

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">BUG详情：</label>
                        <div class="col-md-9">
                            <textarea id="tb_EditBugContext" name="tb_EditBugContext" class="form-control" rows="3"></textarea>
                        </div>
                    </div>
                    <br />

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">BUG处理人：</label>
                        <div class="col-md-9">
                            <select name="select_EditBugHandToUser" id="select_EditBugHandToUser" class="form-control selectpicker">
                                @{
                                    if (userList != null)
                                    {
                                        for (int i = 0; i < userList.Count(); i++)
                                        {
                                    <option value="@userList[i].UserId">@userList[i].UserName</option>
                                        }
                                    }
                                }
                            </select>
                        </div>
                    </div>
                    <br />

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">任务级别：</label>
                        <div class="col-md-9">
                            <select name="select_EditBugLevel" id="select_EditBugLevel" class="form-control selectpicker">
                                <option value="0">低</option>
                                <option value="1">中</option>
                                <option value="2">高</option>
                            </select>
                        </div>
                    </div>
                    <br />

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">BUG处理时间：</label>
                        <div class="col-md-9">
                            <div class="input-append date" id="edit_datetimepicker" data-date-format="yyyy-mm-dd">
                                <input name="tb_DeadTime" value="" id="tb_EditBugDeadTime" style="border-color: cornflowerblue" class="form-control" size="16" type="text">
                                <span class="add-on"><i class="icon-th"></i></span>
                            </div>
                        </div>
                    </div>
                    <hr />

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">原附件：</label>
                        <div class="col-md-9">
                            <a id="a_EditDownloadBugFile">
                                <label id="lb_EditBugFile" class="col-md-8 control-label" for="text-input"></label>
                            </a>
                        </div>
                    </div>
                    <hr />

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">附件：</label>
                        <div class="col-md-9">
                            <input id="lb_EditNewBugFile" style="border-color: cornflowerblue" name="lb_EditNewBugFile" class="form-control" placeholder="Text" type="file">
                        </div>
                    </div>
                    <br />

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        关闭
                    </button>
                    <input type="submit" class="btn btn-primary" value="新增" />
                </div>
            </form>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal -->
</div>

<!-- 新增BUG 模态框（Modal） -->

<script>
    function RestCreate()
    {
        $("#lb_CheckCreateBugMessage").html("");
    }
</script>

<div class="modal fade" id="TaskBookCreateModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">新增BUG
                </h4>
            </div>
            <form id="frm_CreateBug" action="@Url.Action("CreateBug", "Bug")" method="POST" enctype="multipart/form-data">
                <div class="modal-body">
                    <div class="alert alert-danger" id="div_CheckCreateBugMessage" style="display: none">
                        <button type="button" class="close" data-dismiss="alert">×</button>
                        <strong>
                            <label id="lb_CheckCreateBugMessage"></label>
                        </strong>
                    </div>
                    <input type="hidden" name="hid_ProjectId" value="@ViewBag.ProjectId"/>
                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">BUG名称：</label>
                        <div class="col-md-9">
                            <input id="tb_CreateBugName" style="border-color: cornflowerblue" name="tb_BugName" class="form-control" placeholder="Text" type="text">
                        </div>
                    </div>
                    <br />

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">BUG创建人：</label>
                        <div class="col-md-9">
                            <input value="@CurrentUser.UserName" disabled="disabled" style="border-color: cornflowerblue" name="tb_BugCreater" class="form-control" placeholder="Text" type="text">
                        </div>
                    </div>
                    <br />

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">BUG详情：</label>
                        <div class="col-md-9">
                            <textarea id="tb_CreateBugContext" name="tb_BugContext" class="form-control" rows="3"></textarea>
                        </div>
                    </div>
                    <br />

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">BUG处理人：</label>
                        <div class="col-md-9">
                            <select name="select_BugHandToUser" id="select_BugHandToUser" class="form-control selectpicker">
                                @{
                                    if (userList != null)
                                    {
                                        for (int i = 0; i < userList.Count(); i++)
                                        {
                                    <option value="@userList[i].UserId">@userList[i].UserName</option>
                                        }
                                    }
                                }
                            </select>
                        </div>
                    </div>
                    <br />

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">任务级别：</label>
                        <div class="col-md-9">
                            <select name="select_BugLevel" id="select_BugLevel" class="form-control selectpicker">
                                <option value="0">低</option>
                                <option value="1">中</option>
                                <option value="2">高</option>
                            </select>
                        </div>
                    </div>
                    <br />

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">BUG处理截止时间：</label>
                        <div class="col-md-9">
                            <div class="input-append date" id="datetimepicker" data-date="@DateTime.Now.ToString("yyyy-MM-dd")" data-date-format="yyyy-mm-dd">
                                <input name="tb_DeadTime" style="border-color: cornflowerblue" class="form-control" size="16" type="text" value="">
                                <span class="add-on"><i class="icon-th"></i></span>
                            </div>
                        </div>
                    </div>
                    <hr />

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">BUG附件：</label>
                        <div class="col-md-9">
                            <input id="tb_BugFile" style="border-color: cornflowerblue" name="tb_BugFile" class="form-control" placeholder="Text" type="file">
                        </div>
                    </div>
                    <br />

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        关闭
                    </button>
                    <input type="button" onclick="SubmitCreate()" class="btn btn-primary" value="新增" />
                </div>
            </form>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal -->
</div>
<script>
    function SubmitCreate()
    {
        var message = "";
        if ($("#tb_CreateBugName").val() == "" || $.trim($("#tb_CreateBugName").val()) == "")
        {
            message += " · BUG名称不能为空" + "<br/>";
        }
        if ($("#select_BugHandToUser").val() == "")
        {
            message += " · 任务分配人员不能为空" + "<br/>";
        }
        if ($("#tb_CreateBugContext").val() == "" || $.trim($("#tb_CreateBugContext").val()) == "")
        {
            message += " · BUG详情不能为空" + "<br/>";
        }
        if (message != "")
        {
            $("#lb_CheckCreateBugMessage").html(message);
            $("#div_CheckCreateBugMessage").css("display", "block");
            return false;
        }
        else
        {
            $("#lb_CheckCreateBugMessage").html("");
            $("#div_CheckCreateBugMessage").css("display", "none");
            $("#frm_CreateBug").submit();
        }
    }
</script>
